package com.ingrid.javi.activities;

import com.ingrid.javi.R;
import com.ingrid.javi.R.id;
import com.ingrid.javi.R.layout;
import com.ingrid.javi.R.menu;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		Button btMyList = (Button) findViewById(R.id.btMyList);
		Button btRegistryMovie = (Button) findViewById(R.id.btRegistryMovie);
		Button btWishList = (Button) findViewById(R.id.btWishList);
		Button btRegistryWish = (Button) findViewById(R.id.btRegistryWish);

		btMyList.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				onMyListClick();
			}
			
		});

		btRegistryMovie.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				onRegistryClick();
			}

		});

		btWishList.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				onWishListClick();
			}

		});
		
		btRegistryWish.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				onRegistryWishClick();
			}

		});

	}

	protected void onRegistryWishClick() {
		Intent intent = new Intent(this, RegistryActivity.class);
		intent.putExtra(RegistryActivity.EXTRA_MODE, RegistryActivity.EXTRA_MODE_WISH_LIST);
		this.startActivity(intent);		
	}
	
	protected void onRegistryClick() {
		Intent intent = new Intent(this, RegistryActivity.class);
		intent.putExtra(RegistryActivity.EXTRA_MODE, RegistryActivity.EXTRA_MODE_REGISTRY_MOVIE);
		this.startActivity(intent);
	}

	protected void onWishListClick() {
		this.startActivity(new Intent(this, WishListActivity.class));
	}

	private void onMyListClick() {
		this.startActivity(new Intent(this, MyListActivity.class));
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
